package com.ynu.yx.chatroleai.model;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("conversations") // 历史会话信息表
public class Conversation {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField(value = "conversation_id")
    private Long conversationId; //  会话ID

    @TableField(value = "user_id")
    private Long userId; //  用户ID

    @TableField(value = "ai_id")
    private Long aiId; //  角色ID

    @TableField(value = "title")
    private String title; //  会话标题

    @TableField(value = "status")
    private String status; // 会话状态

    @TableField(value = "started_at",  fill = FieldFill.INSERT)
    private LocalDateTime startedAt; //  会话创建的时间

    @TableField(value = "updated_at",  fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    @TableField(value = "last_activity_at")
    private LocalDateTime lastActivityAt; //  会话最后进行的时间

    @TableField(value = "message_count")
    private Integer messageCount; //   会话消息数量

    @TableLogic
    @TableField(value = "is_deleted")
    private Integer isDeleted;

    // 非数据库字段
    @TableField(exist = false)
    private User user;

    @TableField(exist = false)
    private AICharacter character;

    @TableField(exist = false)
    private List<ChatMessage> messages;
}
